<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/17 0017
 * Time: 下午 3:05
 */
namespace app\common\command;
class Notice{
    /**
     * 公告浏览量定时从redis转存到mysql
     */
    public static function writequeue(){
        $redis = \app\common\redis\Redis::getRedisConn();
        $keys = $redis->keys('notice_*');
        foreach ($keys as $k){
            $id = explode('_',$k)[1];
            $click = $redis->get($k);
            \app\admin\model\Notice::where('id',$id)->setInc('readCount',$click);
        }
        $redis->del($keys);
    }
}